/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"6F2B0598-7E93-421B-9177-16FFEDE97158",variableType:4}
 */
var fControl = 0;

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"F13C25FC-56CA-4AB7-9717-F6E850A0BD01"}
 */
var fPass1 = null;

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"50A7530B-7306-4F25-BB8F-9F649B8468E2"}
 */
var fPass2 = null;

/**
 * @properties={typeid:24,uuid:"169E9ABA-0776-49A3-8B7B-792D4803AC10"}
 */
function cambiarPass(event) {
	if(fPass1 == fPass2)
	{
		var p = utils.stringMD5HashBase64(fPass1)
		hash_pass = p
		fPass1 = null
		fPass2 = null
		fecha_cambio_pass = application.getServerTimeStamp()
		databaseManager.saveData()
		fControl = 1
		var $win = application.getWindow('CAMBIO_PASS')
		$win.hide()
		$win.destroy()
	}
	else
	{
		fPass1 = null
		fPass2 = null
		globals.DIALOGS.showErrorDialog('Error','Verificacion de contraseña fallo','OK')
	}
}

/**
 * Handle hide window.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"DDDA5B4F-04C8-4C35-9277-77FCE11F77C5"}
 */
function onHide(event) {
	if (fControl == 1)
	{
		fControl = 0
		return true
	}
	return false
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"C900DE9E-2A6F-4D94-868F-8A91387B3BDA"}
 */
function cancelar(event) {
	fControl = 1
	var $win = application.getWindow('CAMBIO_PASS')
	$win.hide()
	$win.destroy()
}
